/*
 * @Description:休假申请列表字段类型定义
 * @Author: zhihong deng
 * @Date: 2021-09-17 14:03:25
 * @LastEditors: zhihong deng
 * @LastEditTime: 2021-10-06 01:09:56
 */
const mongoose = require('mongoose')
const leaveSchema = mongoose.Schema({
	orderNo: String,
	applyType: Number,
  startTime: {
    type:Date,
    default:Date.now
  },
  endTime: {
    type:Date,
    default:Date.now
  },
  applyUser: {
    userId: String,
    userName: String,
    userEmail: String
  },
  leaveTime: String,
  reasons: String,
  auditUser: String,
  curAuditUserName: String,
  auditFlows: [
    {
      userId: Number,
      userName: String,
      userEmail: String
    }
  ],
  auditLogs: [
    {
      userId: Number,
      userName: String,
      createTime: {
        type:Date,
        default:Date.now
      },
      remark: String,
      action: String
    }
  ],
  applyState: {
    type:Number,
    default:1
  },
  createTime: {
    type:Date,
    default:Date.now
  },
})

module.exports = mongoose.model('leaves', leaveSchema, 'leaves')
